package com.ruoyi.manage.report.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.ListUtil;
import com.ruoyi.manage.report.domain.EnterpriseLoanInfo;
import com.ruoyi.manage.report.mapper.EnterpriseLoanInfoMapper;
import com.ruoyi.manage.report.service.IEnterpriseLoanInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;


/**
 * 企业贷款信息Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-02
 */
@Service
public class EnterpriseLoanInfoServiceImpl extends ServiceImpl<EnterpriseLoanInfoMapper, EnterpriseLoanInfo> implements IEnterpriseLoanInfoService{


    @Override
    public EnterpriseLoanInfo queryGetById(Long platformId){
        EnterpriseLoanInfo enterpriseLoanInfo = this.getById(platformId);
        return enterpriseLoanInfo;
    }

    @Override
    public List<EnterpriseLoanInfo> getBusinessFinancingData() {
        List<EnterpriseLoanInfo> list = baseMapper.selectBusinessFinancingList();
        return list;
    }

    /**
     * 新增企业贷款信息
     *
     * @param enterpriseLoanInfo 企业贷款信息
     * @return 结果
     */
    @Override
    public boolean addEnterpriseLoanInfo(EnterpriseLoanInfo enterpriseLoanInfo){
        boolean save =this.save(enterpriseLoanInfo);
        return save;
    }

    /**
     * 修改企业贷款信息
     *
     * @param enterpriseLoanInfo 企业贷款信息
     * @return 结果
     */
    @Override
    public boolean updateEnterpriseLoanInfo(EnterpriseLoanInfo enterpriseLoanInfo){
        return this.updateById(enterpriseLoanInfo);
    }

    /**
     * 批量删除企业贷款信息
     *
     * @param platformIds 需要删除的企业贷款信息主键
     * @return 结果
     */
    @Override
    public boolean deleteEnterpriseLoanInfoByPlatformIds(Long[] platformIds){
        return this.removeByIds(ListUtil.toList(platformIds));
    }

}
